package net.tycmc.cty.ctyms.timejob.iems.dao;

import java.util.List;
import java.util.Map;

import net.tycmc.bulb.common.dao.IBaseDAO;
import net.tycmc.bulb.common.dao.ITransactionDAO;

public class VehicleInfoDAO {
	
	private IBaseDAO baseDAO;
	
	private ITransactionDAO tranDAO;

	/**
	 * @return the baseDAO
	 */
	public IBaseDAO getBaseDAO() {
		return baseDAO;
	}

	/**
	 * @param baseDAO the baseDAO to set
	 */
	public void setBaseDAO(IBaseDAO baseDAO) {
		this.baseDAO = baseDAO;
	}

	/**
	 * @return the tranDAO
	 */
	public ITransactionDAO getTranDAO() {
		return tranDAO;
	}

	/**
	 * @param tranDAO the tranDAO to set
	 */
	public void setTranDAO(ITransactionDAO tranDAO) {
		this.tranDAO = tranDAO;
	}
	
	/**
	 * 通过设备Id获取设备信息
	 * @param vclId
	 * @return
	 */
	public Map<String,Object> getVclInfoByVclID(String vclId){
		
		String strSQL = "select * from V_VehicleInfo where VehicleID=?";
		
		return baseDAO.execQueryOne(strSQL, new Object[]{vclId});
	}
	
	/**
	 * 根据设备型号获取设备信息
	 * @return
	 */
	public List<Map<String,Object>> getVclsByVclType(String vclTypeId){
		String sql = "select * FROM V_VehicleInfo " +
				"where VehicleTypeID = ? " +
				"and TmnlI_BackoutEnd>=GETDATE() " +
				"and Tmnl_SoftEdition<>'' " +
				"and Tmnl_SoftEdition is not null " +
				"and UsefulLife>=GETDATE()";
		return baseDAO.execQuery(sql, new Object[]{vclTypeId});
	}
}
